/**
 * @param {number[][]} grid
 * @return {boolean}
 */
 var hasValidPath = function(grid) {
   let row = grid.length,col = grid[0].length,traval=true
  let visited = 0
  let startRow = 0,startCol = 0,result
  while(traval){
    result = grid[startRow][startCol],
    visited++
    if(result==1){
      if(startCol+1<col && (grid[startRow][startCol+1]==3 || grid[startRow][startCol+1]==5)){
        visited++
      }
    }

  }
};